<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
  String xm = this.getServletContext().getInitParameter("path");
	String path1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+xm;
%>   
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>添加支付信息</title>

<base target="_self" />
    
    <link href="<%=path1%>/ht/Styles/css.css" rel="stylesheet" type="text/css" />
    <link href="<%=path1%>/ht/Styles/ts_css.css" rel="stylesheet" type="text/css" />
    <script src="<%=path1%>/ht/Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="<%=path1%>/ht/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="<%=path1%>/ht/Scripts/IndexManager.js" type="text/javascript"></script>
    
<script type="text/javascript">
   //添加用途信息
   function addAjax(){
	   //alert("走");
	   $.ajax({
		   data:{
			   purpose:$("#purpose").val()
		   },
		   type:"post",
		   datatype:'json',
		   url:"<%=path1%>/ht/purpose/addPurpose.do",
		   error:function(data){
			   //alert(data);
			   alert("出错了");
		   },
		   success:function(data){
			   //alert(data);
			   alert("用途添加成功");
			   window.location.href="<%=path1%>/ht/purpose/selectAll.do";
			   
		   }
	   });
   }
   

	//关闭当前页面
	function page_Close() {
		if (window.parent != null) {
			window.parent.close();
		} else {
			window.close();
		}
	}
</script>
<script type="text/javascript">
      function purposes(){
    	  var purpose=$("#purpose").val();
    	  if(purpose=="" || purpose==null){
    		  alert("用途不能为空");
    		  $("#purpose").focus();
    		  return false;
    	  }
    	  return true;
      }

   </script>
   
</head>
<body>
    
	<form id="form1" method="post">
		<div id="divTwo">
			<table width="100%" border="0" cellpadding="3" cellspacing="3"
				class="table_list1">
				<h2 align="center">添加用途信息</h2>
				<tr>
					<td width="50%" class="table_list1_style1">
						<p></p> <span style="color: Red">*</span> 用途:
					</td>
					<td width="50%" class="table_list1_style2"><input type="text"
						id="purpose" name="purpose" onblur="purposes()"/></td>

				</tr>
				
				<tr>
					<td class="table_list1_style1">

						<p></p> <input type="button" id="send" value="添加" tabindex="1"
						class="button" onclick="addAjax();" /> &nbsp;
					</td>
					<td  width="1%" class="table_list1_style2">

						<p></p> <input type="button" class="button" value="关闭"
						tabindex="1" onclick="page_Close()" />
					</td>
					<td class="table_list1_style1">&nbsp;</td>
				</tr>
			</table>
		</div>
	</form>
</body>
</html>